<template>
	<view class="ele">
		<my-search :title="title"></my-search>
		
		<!-- 商家列表 -->
		<ul class="list">
			<li class="li" v-for="item,index in list" :key="index" @click="go(item)">
				<image :src="'http://elm.cangdu.org/img/'+item.image_path" mode=""></image>
				<p>{{item.name}}</p>
				<span>
					月销 {{item.recent_order_num}}
				</span>
				<span>
					月销 {{item.distance}}
				</span>
				
			</li>
		</ul>
		
	</view>
</template>

<script>
	import mySearch from '../../components/mySearch.vue'
	export default {
		data() {
			return {
				title:'',
				list:[]
			}
		},
		onLoad() {
			uni.request({
				url:"http://elm.cangdu.org/v2/pois/45.761089,126.631908",
				success: (res) => {
					// console.log(res);
					this.title = res.data.name
				}
			})
			// 附近商家的接口
			uni.request({
				url:'https://elm.cangdu.org/shopping/restaurants?latitude=31.22967&longitude=121.4762',
				success:(res)=>{
					console.log(res);
					this.list = res.data
					
				}
			})
			
		},
		methods: {
			go(item){
				uni.navigateTo({
					url:"../detail/detail?latitude="+item.latitude+"&longitude="+item.longitude+"&id="+item.id
				})
				
				
			}
			
		},
		components:{
			mySearch
		}
	}
</script>

<style lang="scss">
.list{
	.li{
		image{
			width: 200rpx;
			height: 200rpx;
		}
	}
}
</style>
